import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ball_lion/module/mine/widgets/list_cell_box.dart';
import 'package:ball_lion/resources/colours.dart';
import 'package:ball_lion/utils/sp_utils.dart';
import 'package:ball_lion/widgets/base/wqs_text.dart';
import 'package:ball_lion/widgets/ball_appbar.dart';

class UserAdsPage extends StatefulWidget {
  const UserAdsPage({super.key});

  @override
  State<UserAdsPage> createState() => _UserAdsPageState();
}

class _UserAdsPageState extends State<UserAdsPage> {
  bool _open = true;

  bool get open => _open;

  set open(bool value) => setState(() => _open = value);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: Colours.scaffoldBg,
        appBar: const BallAppBar(title: "个性化广告"),
        body: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Container(height: 10),
            ListCellBox(children: [
              Container(
                padding: const EdgeInsets.symmetric(horizontal: 12),
                height: 52,
                child: Row(
                  children: [
                    QsText("个性化广告", fontSize: 16),
                    const Spacer(),
                    CupertinoSwitch(
                        activeColor: Colours.main,
                        value: SpUtils.personalAds,
                        onChanged: (value) {
                          SpUtils.personalAds = value;
                          setState(() {});
                        })
                  ],
                ),
              )
            ]).paddingSymmetric(horizontal: 8),
            Container(height: 4),
            QsText("关闭后，广告数量不变但相关性会降低", fontSize: 13, color: Colours.grey66)
                .paddingSymmetric(horizontal: 16)
          ],
        ));
  }
}
